#ifndef __C_User_Action_Event_Receiver_H_INCLUDED__
#define __C_User_Action_Event_Receiver_H_INCLUDED__

#include "IUserActionEventReceiver.h"
#include "irrMap.h"
#include "Keycodes.h"
#include "irrThread.h"
#include "SMouseConfig.h"
#include "IDeviceManager.h"

namespace game
{
	class CUserActionEventReceiver : public IUserActionEventReceiver
	{
	public:
		//! Destructor
		virtual ~CUserActionEventReceiver();

		CUserActionEventReceiver(IDeviceManager* deviceManager);

		//! called if an event happened. returns true if event was processed
		virtual bool OnEvent(irr::SEvent event);

		//! starts process event process
		virtual void startEventProcess();

		//! stops process event process
		virtual void stopEventProcess();

		//virtual void reset();

	private:
		//! Default constructor
		CUserActionEventReceiver()
		{
		}

		void monitorMouse(void*);

		bool monitorMouseInternal();

		void resetKeyStates();

		IDeviceManager* DeviceManager;

		bool IsRunning;
		irr::core::map<irr::EKEY_CODE, EKEY_STATE> KeyStates;
		irrThread* MouseMonitorThread;
		SMouseConfig* MouseConfig;
	};
}

#endif